/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.googlecode.canoe.core.session.support;

import java.util.HashMap;
import java.util.Map;

import com.googlecode.canoe.core.session.Role;
import com.googlecode.canoe.core.session.Session;

/**
 *
 * @author panzd
 */
public abstract class AbstractSession implements Session {
    private Role role;
    private Map<String, Object> attributeMap;

    public AbstractSession()
    {
        this.attributeMap = new HashMap<String, Object>();
    }
    /**
     * @return the role
     */
    public Role getRole() {
        return role;
    }

    /**
     * @param role the role to set
     */
    public void setRole(Role user) {
        this.role = user;
    }

    public void setAttribute(String key, Object value) {
        attributeMap.put(key, value);
    }

    public Object getAttribute(String key) {
        return attributeMap.get(key);
    }

    public void removeAttribute(String key) {
        attributeMap.remove(key);
    }

    public void clearParameter() {
        attributeMap.clear();
    }
}
